package it.wyx.springboot3kafkaconsumer.service;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author wyx
 * @version V 1
 * @Date 2023/2/13
 */
@Service
public class ConsumerService {

  // org.springframework.kafka.KafkaListenerEndpointContainer#0-0-C-1
  @Async("MyExecutor")
  @KafkaListener(topics = "test-topic")
  public void licecnsePlatListener(ConsumerRecord<String, String> consumerRecord) {
    System.out.println(consumerRecord.toString());
    System.out.println(Thread.currentThread().getName() + " : " + consumerRecord.value());
  }
}
